<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:fn="http://java.sun.com/jsp/jstl/functions"
	xmlns:p="http://primefaces.org/ui"
	template="/templates/loggedTemplate.xhtml">
	
	<f:metadata>
		<f:event type="preRenderView"
			listener="#{advogadoBean.initConversation}" />
	</f:metadata>
	
	<ui:define name="content">
		
		<h1 class="formTitle ui-widget-header ui-corner-all">#{msg['advogado.titulo.cadastro']}</h1>

		<h:form id="advogadoForm">
			
			<p:growl id="messages" />	
			
			<p:panelGrid columns="2" id="panel">
				#{msg['advogado.usuario']}
				<p:selectOneMenu value="#{advogadoBean.entidade.usuario}" id="usuario" height="120"
					converter="viewMapEntityConverter" panelStyle="width:150px" effect="fade" var="sUsuario"
					style="width:160px" filter="true" filterMatchMode="startsWith">
					<f:selectItems value="#{advogadoBean.usuarios}" var="usuario" itemLabel="#{usuario.email}" itemValue="#{usuario}" />
					<p:column>  
                		#{sUsuario.email}  
            		</p:column>
				</p:selectOneMenu>
			
				#{msg['advogado.nome']}
				<p:inputText value="#{advogadoBean.entidade.nome}" id="nome" label="#{msg['advogado.nome']}" />
				
				#{msg['advogado.cpf']}
				<p:inputText value="#{advogadoBean.entidade.cpf}" id="cpf" label="#{msg['advogado.cpf']}" />
				
				#{msg['advogado.numeroOab']}
				<p:inputText value="#{advogadoBean.entidade.numeroOab}" id="numeroOab" label="#{msg['advogado.numeroOab']}" />
				
				#{msg['advogado.ufOab']}
				<p:inputText value="#{advogadoBean.entidade.ufOab}" id="ufOab" label="#{msg['advogado.ufOab']}" />
				
				#{msg['advogado.tipoOab']}
				<p:inputText value="#{advogadoBean.entidade.tipoOab}" id="tipoOab" label="#{msg['advogado.tipoOab']}" />
			</p:panelGrid>
			
			<div id="buttons" class="ui-widget ui-widget-header">
				<p:commandButton value="#{msg['botao.salvar']}" action="#{advogadoBean.salvar}" update="advogadoForm" ajax="false" />
				<p:commandButton value="#{msg['botao.cancelar']}" action="#{advogadoBean.cancelar}" immediate="true" />
			</div>
			
		</h:form>
	</ui:define>
</ui:composition>
